package com.mystudy.springcloud.controller;

import com.mystudy.springcloud.service.SonwflakeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SonwflakeController {
	@Autowired
	SonwflakeService sonwflakeService;

	@GetMapping("/sonwflake")
	public List<Long> sonwflake() {
		return sonwflakeService.snowflakeId();
	}

	@GetMapping("/sonwflake/{workerId}/{datacenterId}")
	public List<Long> sonwflake(@PathVariable("workerId") long workerId, @PathVariable("datacenterId") long datacenterId) {
		return sonwflakeService.snowflakeId(workerId, datacenterId);
	}
}
